package rrrmai.viewbinder;

import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.xgggh.rrrmai.R;
import com.xgggh.rrrmai.databinding.ItemCommentBinding;
import com.xgggh.rrrmai.databinding.ItemContactBinding;

import me.drakeet.multitype.ItemViewBinder;

/**
 * Created by summer on 2018/2/28.
 */
public class ContactViewBinder extends ItemViewBinder<Contact, ContactViewBinder.ViewHolder> {

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        ItemContactBinding binding= DataBindingUtil.inflate(inflater,R.layout.item_contact,parent,false);
        return new ContactViewBinder.ViewHolder(binding.getRoot());
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Contact contact) {
        ItemContactBinding binding= DataBindingUtil.getBinding(holder.itemView);
        binding.setContact(contact);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
